<script type="text/javascript">
jQuery(function(){
	 $(".btn").tooltip();
});
</script>
<?php if(isset($tipo)){?>
<h2><?php echo __('Usuários ').$tipos[$tipo];?></h2>
<?php }else{?>
<h2><?php echo __('Usuários ');?></h2>
<?php }?>

<div class="btn-toolbar">
	<div class="btn-group">
		<?php if(isset($tipo)){?>
			<?php echo $this->Html->link(__('Todos'), array('action'=>'index'), array('class'=>'btn'));?>
		<?php }else{?>
			<?php echo $this->Html->link(__('Todos'), 'javascript:void(0);', array('class'=>'btn btn-inverse disabled'));?>
		<?php }?>
		<?php foreach($tipos as $key=>$item){?>
			<?php if($key == $tipo){?>
				<?php echo $this->Html->link($item, 'javascript:void(0);', array('class'=>'btn btn-inverse disabled'));?>
			<?php }else{?>
			<?php echo $this->Html->link($item, array('action'=>'index', $key), array('class'=>'btn'));?>
			<?php }?>
		<?php }?>
	</div>
</div>
	<br>
	<table cellpadding="0" cellspacing="0" class="table table-striped table-bordered table-hover">
	<thead>
	<tr>
		<th><?php echo $this->Paginator->sort('id'); ?></th>
		<th><?php echo $this->Paginator->sort('login_id'); ?></th>
		<th><?php echo $this->Paginator->sort('email'); ?></th>
		<th><?php echo $this->Paginator->sort('nome'); ?></th>
		<th><?php echo $this->Paginator->sort('sexo'); ?></th>
		<th><?php echo $this->Paginator->sort('tipo'); ?></th>
		<th class="actions"></th>
	</tr>
	</thead>
	<tbody>
	<?php foreach ($usuarios as $usuario): ?>
	<tr>
		<td><?php echo h($usuario['Usuario']['id']); ?>&nbsp;</td>
		<td><?php echo h($usuario['Login']['login']); ?>&nbsp;</td>
		<td><?php echo h($usuario['Usuario']['email']); ?>&nbsp;</td>
		<td><?php echo h($usuario['Usuario']['nome']); ?>&nbsp;</td>
		<td><?php echo h($usuario['Usuario']['sexo']); ?>&nbsp;</td>
		<td><?php switch($usuario['Login']['tipo']){
				case 0:
					echo 'Admin Geral';
					break;
				case 1:
					echo 'Revisor';
					break;
				case 2:
					echo 'Recepcionista';
					break;
				case 3:
					echo 'Usuario comum';
					break;
				case 4:
					echo 'Admin Evento';
					break;
			} ?>&nbsp;</td>
		<td class="actions">
			<div class="btn-toolbar">
			  <div class="btn-group">
			  	<?php echo $this->Html->link('<i class="icon-user"></i>', array('action' => 'view', $usuario['Usuario']['id']), array('class'=>'btn', 'escape'=>false, 'title'=>__('Ver'))); ?>
			    <?php if($editavel) echo $this->Html->link('<i class="icon-edit"></i>', array('action' => 'edit', $usuario['Usuario']['id']), array('class'=>'btn', 'title'=>__('Alterar'), 'escape'=>false)); ?>
			    <?php if($editavel) echo $this->Form->postLink('<i class="icon-trash"></i>', array('action' => 'delete', $usuario['Usuario']['id']), array('class'=>'btn', 'escape'=>false, 'title'=>__('Excluir usuário')), __('Tem certeza que deseja escluir o usuário %s?', $usuario['Login']['login'])); ?>
			    <?php if($tipo == 3 ) echo $this->Form->postLink('<i class="icon-remove"></i>', array('controller' => 'pagamentos','action' => 'delete', $usuario['Pagamento']['id']), 
			    								 array('class'=>'btn', 'escape'=>false, 'title'=>__('Cancelar inscrição')), 
			    								 __('Deseja realmente remover a inscrição de %s?', $usuario['Login']['login'])); ?>
			  </div>
			</div>
		</td>
	</tr>
<?php endforeach; ?>
	</tbody>
</table>
<p class="text-info">
<?php
echo $this->Paginator->counter(array(
'format' => __('Página {:page} de {:pages}, total de {:count} registros')
));
?>	</p>
<div class="pagination pagination-centered">
	<ul>
		<?php echo $this->Paginator->prev(
			'< '.__('Anterior'),
			array('tag' => 'li', 'class' => 'prev'),
			'<a>< '.__('Anterior').'</a>',
			array('tag' => 'li', 'escape' => false, 'class' => 'prev disabled')
		);?>
		<?php echo $this->Paginator->numbers(array('separator' => '', 'tag'=>'li', 'currentTag'=>'a', 'currentClass'=>'active')); ?>
		<?php echo $this->Paginator->next(
			__('Próximo'). ' >',
			array('tag' => 'li', 'class' => 'prev'),
			'<a>'.__('Próximo').' ></a>',
			array('tag' => 'li', 'escape' => false, 'class' => 'prev disabled')
		);?>
	</ul>
</div>